﻿@using AmorCanino.Web.Models.Authentication
@{
    Layout = "~/Views/Shared/_LayoutWithoutCategory.cshtml";
    bool isAdmin = AuthUser.Current().IsInRole("admin");
    string pageTitle = isAdmin ? "Administración" : "Perfil";
    ViewBag.Title = pageTitle;

    string profileSelected = Context.Request.Url.AbsolutePath.ToLowerInvariant().Contains("index") ? "selected" : "";
    string messagesSelected = Context.Request.Url.AbsolutePath.ToLowerInvariant().Contains("messages") ? "selected" : "";
    string productsSelected = Context.Request.Url.AbsolutePath.ToLowerInvariant().Contains("products") ? "selected" : "";
    string myPetsSelected = Context.Request.Url.AbsolutePath.ToLowerInvariant().Contains("mypets") ? "selected" : "";
    
    if (string.IsNullOrWhiteSpace(profileSelected) &&
        string.IsNullOrWhiteSpace(messagesSelected) &&
        string.IsNullOrWhiteSpace(productsSelected) &&
        string.IsNullOrWhiteSpace(myPetsSelected))
    {profileSelected = "selected";}
}
@RenderSection("JavaScript", required: false)
<div class="account-container">
    <div class="profile-container">
        <h2>@pageTitle</h2>
        <div class="topmenu">
            <ul>
                <li class="@profileSelected">
                    @Html.ActionLink("Mi Perfíl", "Index")
                </li>
                <li class="@myPetsSelected">
                    @Html.ActionLink("Mis mascotas", "MyPets")
                </li>
                <li class="@messagesSelected">
                    @Html.ActionLink("Mensajes", "Messages")
                </li>
                @if (isAdmin)
                {
                <li class="@productsSelected">
                    @Html.ActionLink("Productos", "Products")
                </li>
                }
            </ul>
        </div>
    </div>
    <div>
        @RenderBody()
    </div>
</div>